
$.notify = {};
$(function(o){
	o.updateData = function(showArea,timestamp){
		var reqUrl = "/aeat/sec/check?initTime="+timestamp;
		$.ajax({
			type : "GET",
			url  : reqUrl,
			success : function(obj){
				console.log(obj);
				if(obj.data>0){
					$(showArea).parent().parent().show();
					$(showArea).html("You have "+obj.data+" new verify message.");
				}else{
					$(showArea).parent().parent().hide();
					$(showArea).html("");
			 	}
			}
		});
	};
	
	o.work = function(showArea,timestamp,ms){
		window.setInterval( function(){ o.updateData(showArea,timestamp); } , ms );
	};
	
	o.getUrlParam = function(name){
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
	};
	
}($.notify));
